package com.example.demo.redis.service.impl;

import com.example.demo.model.Material;
import com.example.demo.redis.mapper.RedisMapper;
import com.example.demo.redis.repository.RedisRepository;
import com.example.demo.redis.service.RedisService;
import com.example.demo.util.Result;
import com.example.demo.util.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2018/12/27.
 */
@Service
public class RedisServiceImpl implements RedisService{

    @Autowired
    private RedisRepository redisRepository;
    @Override
    public Result<List<Material>> queryMaterials(Integer id) {
        List<Material> materials = redisRepository.queryMaterials(id);
        return ResultVo.success(materials);
    }

    @Override
    public Result<List<Material>> updateMaterialById(Material material) {

        return redisRepository.updateMaterialById(material);

    }

    @Override
    public void deleteMaterialById(Integer id) {

        redisRepository.deleteMaterialById(id);
    }
}
